home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / RGSTRBGI.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  1.1 KB  |  39 lines

  1. /* Use a project file with this program and EGAVGA.OBJ
  2.  * in it. Use BGIOBJ to convert EGAVGA.BGI to EGAVGA.OBJ
  3.  * before linking the program.
  4.  */
  5.  
  6.  #include <stdio.h>
  7.  #include <graphics.h>
  8.  #include <alloc.h>
  9.  
  10.  main()
  11.  {
  12.    int errorcode;
  13.    int graphdriver = DETECT;
  14.    int graphmode;
  15.    /* Register the linked in driver EGAVGA */
  16.      if(registerbgidriver(EGAVGA_driver) < 0)
  17.      {
  18.         printf("Driver could not be registered!\n");
  19.         exit(0);
  20.      }
  21.  /* Detect and initialize graphics system */
  22.    initgraph(&graphdriver, &graphmode, NULL);
  23.    errorcode = graphresult();
  24.    if (errorcode != gr0k)
  25.    {
  26.      printf("Graphics error: %s\n",
  27.      grapherrormsg(errorcode));
  28.      exit(1);
  29.    };
  30.     settext justify(CENTER_TEXT, CENTER_TEXT);
  31.    settextstyle(SANS_SERIF_FONT, HORIZ_DIR, 1);
  32.    outtextxy( getmaxx() /2, getmaxy() /2,
  33.    "This program uses a linked-in driver: EGAVGA");
  34.  
  35.     outtextxy(getmaxx()/2, getmaxy() - 50,
  36.               "Press any key to exit:");
  37.    getch();        /* Wait until a key is pressed */
  38.    closegraph;           /* Exit graphics library */
  39. }